package com.wsdk.view;

import android.app.Dialog;
import android.content.Context;
import android.view.Display;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import com.wsdk.R;
import com.wsdk.Wsdk;

public class BaseDialog
        extends Dialog {

    public BaseDialog(Context context) {
        super(context, R.style.MyDialogStyle);
        setCancelable(true);
        setCanceledOnTouchOutside(true);
    }

    @Override
    public void show() {
        super.show();
        Window dialogWindow = getWindow();
        dialogWindow.setGravity(Gravity.CENTER);
        WindowManager m = dialogWindow.getWindowManager();
        Display d = m.getDefaultDisplay();
        WindowManager.LayoutParams p = getWindow().getAttributes();
        p.dimAmount = 0.7f;
        p.width = (int) (Wsdk.screenWidth * 0.8);
        dialogWindow.setAttributes(p);
    }
}
